package cn.wolfcode.luowowo.util;

import cn.wolfcode.luowowo.exception.LogicException;
import org.springframework.util.StringUtils;

/**
 * 判断空值和是否相等
 */
public class AssertUtils {

    // 判断传入值是否为空
    public static void hasLength(String v,String msg){
        if (!StringUtils.hasLength(v)) {
            throw new LogicException(msg);
        }
    }


    public static void isEquals(String v1, String v2 ,String msg){
        // 判断传入值是否为空
        if (v1 == null || v2 == null ){
            throw  new LogicException("传入参数不能为空");
        }

        // 判断两个值是否相等
        if (!v1.equals(v2)){
            throw new LogicException(msg);
        }
    }
}
